package com.dc.refactoring._6_处理概括关系._11_ReplaceInhertanceWithDelegation.step2;

import java.util.Vector;

/**
 * Description: 将继承关系修改为委托关系
 * @author: gdc
 * @date: 2020/12/13
 * @version 1.0
 */
// step 1 打破与超类的联系
//public class MyStack extends Vector {
public class MyStack{

    //private Vector vector = this;
    private Vector vector = new Vector();

    public void push(Object element) {
        vector.insertElementAt(element, 0);
    }

    public Object pop() {
        Object result = vector.firstElement();
        vector.removeElementAt(0);
        return result;
    }
}
